package SocialMediaSentiment;

import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;

import jxl.write.WriteException;

public class MakeTweetList {
	public static void main( String args[]){
		HashMap<Integer, String[]> tweetLijstSentiment;
		HashMap<String, String> tweetSentiment = new HashMap<String, String>();

		try{
			tweetLijstSentiment = ReadExcel.read("Trainset.xls", 9, 4);

			String[] woordenlijstSentimentData;
			String tweet;
			int sentiment;
			Iterator<Integer> k = tweetLijstSentiment.keySet().iterator();
			while (k.hasNext()) {
				woordenlijstSentimentData = tweetLijstSentiment.get(k
						.next());
				tweet = woordenlijstSentimentData[0];
				sentiment = Integer.parseInt(woordenlijstSentimentData[1]);
				if(sentiment!=0){
					tweetSentiment.put(tweet, ""+sentiment);

				}
			}
		}
		catch (IOException e) {

			e.printStackTrace();
		}
		try{
			writeExcel.write("tweetSentiment.xls", tweetSentiment);
			System.out.println("made files.");
		} catch (WriteException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}


	}
}
